# coding:utf-8

from tingshu.ThreadUtil import myThread
from biquge.util import getSoup


#听书网点击排行榜上的有声小说
index_url = 'http://www.ting56.com/paihangbang.html'

base_url = 'http://www.ting56.com/'

index_soup = getSoup(index_url)

#获取所有小说数据
lbbnames = index_soup.find(class_="liebiao").find_all(class_="lbbname")

#章节地址
zj_url_list = []
for item in lbbnames:
    index = item.text.find('完结')
    if index >0:
        zj_url = item.find('a').get('href')
        zj_url_list.append(base_url+zj_url)


thread_list=[]


num = 0
# 创建线程
for item in zj_url_list[0:10]:
    num = num+1
    xsThread = myThread(num, 'Thread-' + str(num),item,base_url)
    xsThread.start()
    thread_list.append(xsThread)

for t in thread_list:
    t.join()

print("结束")

